package com.mowwang.file;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Buffered {
    public static void writer(){
        BufferedWriter bw=null;
        try {
            FileWriter fileWriter=new FileWriter("c.txt");
            bw=new BufferedWriter(fileWriter);
            for (int i = 0; i < 10; i++) {
                bw.write("java真好学，实在是简单！");
                bw.newLine();

            }

            bw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {

                try {if (bw!=null)
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }

        }


    }
    public static void main(String[] args) {
        writer();
    }
}
